<template>
	<view class="">
	<view class="common-body" v-for="(item,index) in baseList" :key="index">
		<view class="common-list">
				<label class="common-list-title">供应商名称 :</label>
				<text class="common-list-text" :selectable="true">{{item.supplierName}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">订单编号 :</label>
				<text class="common-list-text" :selectable="true">{{item.orderCode}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">合同编码 :</label>
				<text class="common-list-text" :selectable="true">{{item.contractCode}}</text>
		</view>
		<view class="common-list">
			<view style="width:50%;">
				<label class="common-list-title">订单状态 :</label>
				<text class="common-list-text">{{orderStatus[item.orderState] || orderStatus['default']}}</text>
			</view>
			<view style="width:50%;margin-left: 20px;">
				<label class="common-list-title">录入计价次数 :</label>
				<text class="common-list-text">{{item.valuationDetails.length}}</text>
			</view>
		</view>
		<view class="common-list">
				<label class="common-list-title">商合预占数 :</label>
				<text class="common-list-text">{{item.shNum}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">单价（元） :</label>
				<text class="common-list-text">{{item.price}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">商合预占金额 :</label>
				<text class="common-list-text">{{item.shMoney}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">累计验工数量 :</label>
				<text class="common-list-text">{{item.sumNum}}</text>
		</view>
		<view class="common-list">
				<label class="common-list-title">累计验工金额 :</label>
				<text class="common-list-text">{{item.sumMoney}}</text>
		</view>
	</view>
	<!--  -->
	<view class="common-body-ex" >
		<view class="common-list-ex">
				<label class="common-list-title-ex">付款类型 :</label>
			<text class="common-list-text-ex">进度款</text>
		</view>
		<view class="common-list-ex">
				<label class="common-list-title-ex"><text class="colorRed">*</text>项目进度(%) :</label>
				<input @input="inputClick"  maxlength="12" class="common-list-inpur-ex" type="digit"  v-model="form.projectProgress" placeholder="请输入"/>
		</view>
		<view class="common-list-ex">
				<label class="common-list-title-ex"><text class="colorRed">*</text>本期验工数量 :</label>
				<input @blur="blurclick" class="common-list-inpur-ex" type="digit"  v-model="form.currentInspectionNum" :disabled="disabledNum" placeholder="请输入"/>
		</view>
		<view class="common-list-ex">
				<label class="common-list-title-ex"><text class="colorRed">*</text>本期验工金额 :</label>
				<input @input="blurclickMen" class="common-list-inpur-ex" type="digit"  v-model="form.currentInspectionMoney"  :disabled="true" placeholder="请输入"/>
		</view>
		<view class="common-list-ex">
				<label class="common-list-title-ex">累计验工数量 :</label>
				<text class="common-list-text-ex">{{form.sumNum}}</text>
		</view>
		<view class="common-list-ex">
				<label class="common-list-title-ex">累计验工金额 :</label>
				<text class="common-list-text-ex">{{form.sumMoney}}</text>
		</view>
	</view>
	<view class="common-btn-body">
		<button  class="common-btn" type="warn" v-debounce="save">提交</button>
		<button  class="common-btn" v-debounce="quxiao" style="border:1px solid #EB4B4B;color:#EB4B4B ;">取消</button>
	</view>
</view>
</template>

<script>
	import talkingdata from '../../common/talkingdata.js';
  import {postApi} from "@/inspur/utils/request";
  const orderStatus = {
    '1':'有效',
    '0':'无效',
    '-1':'冻结',
    'default':'取消冻结'
  }
	var mThis
	export default {
		data() {
			return {
        detail:{},
        orderStatus,
        form:{
          payType:'PROGRESSING',
          projectProgress: '', // 进度
          currentInspectionNum: '', // 本期数量
          currentInspectionMoney: '', // 本期金额
          sumNum: '', // 累计数量
          sumMoney: '', // 累计金额
        },
        edit:{
          currentInspectionNum: '0', // 本期数量
          currentInspectionMoney: '0', // 本期金额
        },
        disabledNum:false,
        isNew: false,
        minSumNum: '',
        isEdit: false,
				baseList: [],
				addlist:[],
        valuationId: '',
				currentjindu:'',
				currentNum:'',
				currentMen:'',
				leijiNum:'0',
				leijiMen:'0',
				numflag:false,
			}
		},
		onLoad({valuationId,isNew,isEdit}) {
			this.valuationId = valuationId
      this.isNew = JSON.parse(isNew)
      this.isEdit = JSON.parse(isEdit)
			this.getList()
		},
		onReady(){
      if (this.isEdit)  {
        uni.setNavigationBarTitle({
          title: '修改验工计价'
        })
      }
      
			//在页面挂载完成后，调用外部埋点，统计数据
			 const script= document.createElement('script');
			 script.type = 'text/javascript';
			 script.src = talkingdata.talkingKey;
			 document.body.appendChild(script);
		},
    computed:{
      disabledMen(){
        return this.form.projectProgress !== 100
      }
    },
    watch:{
      // 'form.currentInspectionNum'(){
      //   this.setSumNum()
      // },
      // 'form.currentInspectionMoney'(){
      //   this.setSumMoney()
      // }
    },
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
      // 计算本期验工金额
      setCurrentInspectionMoney(){
        // todo 可能有精度问题
        if (Number(this.form.sumNum)==Number(this.baseList[0].shNum)){
          this.form.currentInspectionMoney = (Number(this.baseList[0].shMoney) - Number(this.baseList[0].sumMoney)+Number(this.edit.currentInspectionMoney)).toFixed(2)
        }else{
          this.form.currentInspectionMoney = (this.form.currentInspectionNum * this.baseList[0].price).toFixed(2)
        }
        this.setSumMoney()
      },
      // 计算累计验工数量
      setSumNum(){
        this.form.sumNum = (Number(this.form.currentInspectionNum) + Number(this.baseList[0].sumNum) - Number(this.edit.currentInspectionNum)).toFixed(this.isNew?Number(this.baseList[0].spuUnitAcc)||0:4)
      },
      // 计算累计验工金额
      setSumMoney(){
        this.form.sumMoney = (Number(this.form.currentInspectionMoney) + Number(this.baseList[0].sumMoney)- Number(this.edit.currentInspectionMoney)).toFixed(2)
      },
			quxiao(){
        uni.navigateBack({
          delta: 1
        })
			},
      formatNumber(num,v=2) {
        if (Number.isInteger(num)) {
          return num; // 如果是整数，直接返回整数
        } else {
          const str = num.toString();
          const decimalIndex = str.indexOf('.');
          if (decimalIndex !== -1 && str.length - decimalIndex > v+1) {
            return Number(str.slice(0, decimalIndex + v+1));
          } else {
            return num;
          }
        }
      },
      // 项目进度
			inputClick(){
        // 0-100的整数
				 let price = JSON.parse(JSON.stringify(this.form.projectProgress));
        price = this.formatNumber(price,0)
        if (price>100){ price = 100}
        if (price<0){ price = 0}
        else {this.setCurrentInspectionMoney()}
				 setTimeout(() => {
				    this.form.projectProgress = price;
				 }, 100)
			},
			blurclick(){
				//小于等于商合预占数,且和商合预占数的精度一致,老项目精度默认四位
				let val = Number(this.form.currentInspectionNum);
        
        if (this.isNew){
          val = this.formatNumber(val, Number(this.baseList[0].spuUnitAcc) || 0)
        }else{
          val = this.formatNumber(val, 4)
        }
        if (val < 0){
          val = 0
        }
        console.log(val)
				setTimeout(() => {
				   this.form.currentInspectionNum = val;
          this.setSumNum()
          this.setCurrentInspectionMoney()
				}, 100)
			},
			blurclickMen(){
				//控制保留4位start
			let val = Number(this.form.currentInspectionMoney);
			val = this.formatNumber(val, 2)
			if (val < 0){
			  val = 0
			}
				console.log("1触发校验"+val)
				setTimeout(() => {
				   this.form.currentInspectionMoney = val;
           this.setSumMoney()
				}, 100)
        return
				//end
				console.log("触发")
				 if(this.baseList[0].onlyBe1Flag == "N"){
					 if(this.currentNum == "1" && this.currentMen != ""){
						this.blurClickMenOne();
					 }
				 }
				this.leijiMen = Number(this.baseList[0].sumMoney) + Number(this.currentMen)
				this.leijiMen = this.leijiMen.toFixed(4)
			},
			blurClickMenOne(){
				let that=this;
				if(Number(this.currentMen) >(Number(this.menflag)+10) ||  Number(this.currentMen) <(Number(this.menflag)+10)){
					console.log("出错");
					uni.showModal({
						confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: '验工计价金额只能在系统计算的合价范围内上下浮动10元',
						showCancel: false,
						success: function (res) {
							that.currentNum = that.menflag.toFixed(4)
						}
					})
				}
			},
			/**
			 * @author: MrLiu
			 * @time: 2021-09-15
			 * @Title: 工序详情
			 */
			getList() {
        let that = this
			  postApi('/material/api/insVa/app/queryValDetailsByVid',{params:{valuationId:this.valuationId}}).then(res=>{
          that.baseList = res.data.valuationInfo
          if (that.isEdit){
            const valuationDetails = res.data.valuationInfo[0].valuationDetails
            const detail = valuationDetails[valuationDetails.length-1]
            this.form.projectProgress = detail.projectProgress
            this.form.currentInspectionNum = detail.currentInspectionNum
            this.form.currentInspectionMoney = detail.currentInspectionMoney
            this.edit.currentInspectionNum = detail.currentInspectionNum
            this.edit.currentInspectionMoney = detail.currentInspectionMoney
            this.setSumNum()
            this.setSumMoney()
          }
          that.getCheckInsVaData()
            //如果这个字段是Y   那么数量只能填写1   本次验工计价金额需要人工填写
            // if(that.baseList[0].onlyBe1Flag == "Y"){
            //   that.currentNum = "1"
            //   that.disabledNum = true
            //   //onlyBe1Flag=Y时，若累计验工金额等于预估单金额，则进度必须100%
            //   if(that.baseList[0].sumMoney === that.baseList[0].shMoney){
            //     that.currentjindu = "100"
            //   }
            // }
        })
			},
      farmatNum(Num) { // 四舍五入保留4位小数
        var pum = 0
        var value = ''
        if (Num < 0) {
          pum = -Num
        } else {
          pum = Num
        }
        value = Math.round(Number(pum) * Math.pow(10, 4)) / Math.pow(10, 4)
        // if (this.newOldProject === '1') {
        // } else {
        //   value = Math.round(Number(pum) * Math.pow(10, 9)) / Math.pow(10, 9)
        // }
        if (Num < 0) {
          return -value
        } else {
          return value
        }
      },
      getCheckInsVaData(){
        let that = this
        const data = {
          "serviceCode": that.baseList[0].serviceCode,
          "subPrjId": that.baseList[0].subPrjId,
          "prjId":that.baseList[0].prjId
        }
        postApi('/material/api/insVa/module/getCheckInsVaData',{data}).then(gCheckData=>{
          var allServiceSumNum = 0 // 服务所有订单下累计验工数量
          // var allServiceShMoneySum = 0 // 服务所有订单下商合预占金额的和
          var allServiceShNumSum = 0 // 服务所有订单下商合预占数量的和
          var allServiceTServListAmount = 0 // 设计表服务数量
          // var allServiceTServListEquipSum = 0 // 设计表服务及金额
          var allServiceTServListAdjAmount = 0 // 设计变更表服务数量
          // var allServiceTServListAdjEquipSum = 0 // 设计变更表服务及金额
          var allSupplementNum = 0 // 在建工程损失补采数量
          // var minSumMoney = 0
          var minSumNum = 0
          var siteId= that.baseList[0].siteId
          var serviceCode= that.baseList[0].serviceCode
          // allServiceSumMoney = this.farmatMoney(Number(gCheckData.data.currentInspectionSum.CURRENT_INSPECTION_MONEY_SUM) + Number(currentInspectionMoney))
          allServiceSumNum = this.farmatNum(Number(gCheckData.data.currentInspectionSum.CURRENT_INSPECTION_NUM_SUM) + Number(this.form.currentInspectionNum)) // 所有订单累计数量+当前所填本期验工数量
          // allServiceShMoneySum = gCheckData.data.shSum.SH_MONEY_SUM
          allServiceShNumSum = gCheckData.data.shSum.SH_NUM_SUM
          if (gCheckData.data.supplementNum.SUPPLEMENT_NUM) {
            allSupplementNum = gCheckData.data.supplementNum.SUPPLEMENT_NUM // 在建工程损失补采数量
          }
          // allServiceTServListEquipSum = gCheckData.data.serListSum.SJ_MONEY
          allServiceTServListAmount = gCheckData.data.serListSum.SJ_AMOUNT
		  //解决if问题，注释掉，条件里只有log
          // if (allServiceTServListAmount == null) {
          //   console.log('服务设计表中无站址编码：' + siteId + '，服务编码：' + serviceCode + '的服务数据')
          // }
          allServiceTServListAmount = allServiceTServListAmount + allSupplementNum
          if (gCheckData.data.serListAdjSum.SJ_ADJ_AMOUNT || gCheckData.data.serListAdjSum.SJ_ADJ_MONEY) { // 设计变更表中有数据已发生设计变更  在商合、设计+补采、设计变更+补采 金额中取最小值
            // allServiceTServListAdjEquipSum = gCheckData.data.serListAdjSum.SERLISTADJEQUIPSUM
            allServiceTServListAdjAmount = gCheckData.data.serListAdjSum.SERLISTADJAMOUNT | 0 // todo 少字段
		  	//解决if问题，注释掉，条件里只有log
		  	// if (allServiceTServListAdjAmount == null) {
            //   console.log('服务设计变更表中无站址编码：' + siteId + '，服务编码：' + serviceCode + '的服务数据')
            // }
            console.log({allServiceTServListAdjAmount,allSupplementNum})
            allServiceTServListAdjAmount = allServiceTServListAdjAmount + allSupplementNum
            // 商合、设计、设计变更金额取最小值
            minSumNum = this.getMinSumNumOne(allServiceShNumSum,allServiceTServListAmount,allServiceTServListAdjAmount);
          } else {
            // if (allServiceShNumSum > allServiceTServListAmount) {
            //   minSumNum = allServiceTServListAmount
            // } else {
            //   minSumNum = allServiceShNumSum
            // }
			minSumNum = this.getMinSumNumTwo(allServiceShNumSum,allServiceTServListAmount)
          }
          console.log({allServiceTServListAmount,allServiceShNumSum,allServiceTServListAdjAmount})
          this.minSumNum = minSumNum
          console.log(minSumNum)
        })
      },
	  getMinSumNumOne(allServiceShNumSum,allServiceTServListAmount,allServiceTServListAdjAmount){
		return 	allServiceShNumSum < allServiceTServListAmount
				? (allServiceShNumSum < allServiceTServListAdjAmount ? allServiceShNumSum : allServiceTServListAdjAmount)
				: (allServiceTServListAmount < allServiceTServListAdjAmount ? allServiceTServListAmount : allServiceTServListAdjAmount)
	  },
	  getMinSumNumTwo(allServiceShNumSum,allServiceTServListAmount){
		return 	allServiceShNumSum > allServiceTServListAmount?	allServiceTServListAmount:allServiceShNumSum
	  },
      farmatMoney(money) { // 四舍五入保留2位小数
        var pum = 0
        var value = ''
        if (money < 0) {
          pum = -money
        } else {
          pum = money
        }
        value = Math.round(pum * Math.pow(10, 2)) / Math.pow(10, 2)
        // if (this.newOldProject === '1') {
        //   value = Math.round(pum * Math.pow(10, 9)) / Math.pow(10, 9)
        // } else {
        //   value = Number(pum)
        // }
        if (money < 0) {
          return -value
        } else {
          return value
        }
      },
		/**
		 * @author: MrLiu
		 * @time: 2021-11-23
		 * @Title: 保存
		 */
		getCheckOne(){
			return new Promise((resolve,reject) => {
				if(this.form.projectProgress == ""){
					uni.showModal({
						confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "请输入项目进度",
						showCancel: false,
					})
					reject('fail')
				}else{
					resolve('success')
				}
			});
		},
		getCheckTwo(){
			return new Promise((resolve,reject) => {
				if(this.form.currentInspectionNum == ""){
					uni.showModal({
						confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "请输入本期验工数量",
						showCancel: false,
					})
					reject('fail')
				}else{
					resolve('success')
				}
			});
		},
		getCheckThree(){
			return new Promise((resolve,reject) => {
				if(this.form.currentInspectionMoney== ""){
					uni.showModal({
						confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "请输入本期验工金额",
						showCancel: false,
					})
					reject('fail')
				}else{
					resolve('success')
				}
			});
		},
		getCheckFour(){
			return new Promise((resolve,reject) => {
				if(Number(this.form.sumNum)>Number(this.baseList[0].shNum)){
					uni.showModal({
						confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "累计验工数量小于等于：商合预占数、设计数量、在途设计变更的最小值",
						showCancel: false,
					})
					reject('fail')
				}else{
					resolve('success')
				}
			});
		},
		getCheckFive(){
			return new Promise((resolve,reject) => {
				if (Number(this.form.sumNum) > Number(this.baseList[0].shNum)){
					if(Number(this.form.projectProgress)!=100){
						uni.showModal({confirmColor: '#eb4b4b',
							title: '温馨提示',
							content: "当前预估单的累计验工金额应小于等于商合预占金额",
							showCancel: false,
						})
						reject('fail')
					}else{
						resolve('success')
					}
				}else{
					resolve('success')
				}
			});
		},
		getCheckSix(){
			const num = this.form.currentInspectionNum * this.baseList[0].price
			return new Promise((resolve,reject) => {
				if (Math.abs(num - this.form.currentInspectionMoney) > 10){
					uni.showModal({confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "只能调整上下10以内",
						showCancel: false,
					})
					reject('fail')
				}else{
					resolve('success')
				}
			});
		},
		getCheckSeven(){
			return new Promise((resolve,reject) => {
				if (Number(this.form.sumMoney) == Number(this.baseList[0].sumMoney)){
					if(Number(this.form.sumNum)!=Number(this.baseList[0].sumNum)){
						uni.showModal({confirmColor: '#eb4b4b',
							title: '温馨提示',
							content: "累计验工计价金额等于商合预占金额时，数量也必须相等",
							showCancel: false,
						})
						reject('fail')
					}else{
						resolve('success')
					}
				}else{
					resolve('success')
				}
			});
		},
	async save() {
		let that = this
		// if(that.form.projectProgress == ""){
		// 	uni.showModal({confirmColor: '#eb4b4b',
		// 		title: '温馨提示',
		// 		content: "请输入项目进度",
		// 		showCancel: false,
		// 	})
		// 	return;
		// }
		await this.getCheckOne();
		await this.getCheckTwo();
		await this.getCheckThree();
		await this.getCheckFour();
		await this.getCheckFive();

		// if(that.form.currentInspectionNum == ""){
		// 	uni.showModal({confirmColor: '#eb4b4b',
		// 		title: '温馨提示',
		// 		content: "请输入本期验工数量",
		// 		showCancel: false,
		// 	})
		// 	return;
		// }
		// if(that.form.currentInspectionMoney== ""){
		// 	uni.showModal({confirmColor: '#eb4b4b',
		// 		title: '温馨提示',
		// 		content: "请输入本期验工金额",
		// 		showCancel: false,
		// 	})
		// 	return;
		// }
		// if(Number(that.form.sumNum)>Number(this.baseList[0].shNum)){
		//   uni.showModal({confirmColor: '#eb4b4b',
		// 	title: '温馨提示',
		// 	content: "累计验工数量小于等于：商合预占数、设计数量、在途设计变更的最小值",
		// 	showCancel: false,
		//   })
		//   return;
		// }
		// if (Number(this.form.sumNum) > Number(this.baseList[0].shNum)){
		//   if(Number(that.form.projectProgress)!=100){
		// 	uni.showModal({confirmColor: '#eb4b4b',
		// 	  title: '温馨提示',
		// 	  content: "当前预估单的累计验工金额应小于等于商合预占金额",
		// 	  showCancel: false,
		// 	})
		// 	return;
		//   }
		// }
        let tit = "是否确认提交?"
        if(Number(that.form.projectProgress)==100){
          tit= "当前验工计价进度为100%"
          // 进度100可以上下浮动10,所有要进行比较
          // const num = this.form.currentInspectionNum * this.baseList[0].price
          // if (Math.abs(num - this.form.currentInspectionMoney) > 10){
          //   uni.showModal({confirmColor: '#eb4b4b',
          //     title: '温馨提示',
          //     content: "只能调整上下10以内",
          //     showCancel: false,
          //   })
          //   return;
          // }
			await this.getCheckSix();
        }
        // if (Number(this.form.sumMoney) == Number(this.baseList[0].sumMoney)){
        //   if(Number(that.form.sumNum)!=Number(that.baseList[0].sumNum)){
        //     uni.showModal({confirmColor: '#eb4b4b',
        //       title: '温馨提示',
        //       content: "累计验工计价金额等于商合预占金额时，数量也必须相等",
        //       showCancel: false,
        //     })
        //     return;
        //   }
        // }
		await this.getCheckSeven();
        if (Number(this.form.sumNum) == Number(this.baseList[0].shNum)){
          tit= "本次验工计价新增完成后，当前商合服务订单的验工计价已经全部验满，请知晓"
          if(Number(that.form.projectProgress)!=100){
            uni.showModal({confirmColor: '#eb4b4b',
              title: '温馨提示',
              content: "累计验工计价数量等于商合预占数时，项目进度必须为100%",
              showCancel: false,
            })
            return;
          }
          if(Number(that.form.sumMoney)!=Number(that.baseList[0].shMoney)){
            uni.showModal({confirmColor: '#eb4b4b',
              title: '温馨提示',
              content: "累计验工计价数量等于商合预占数时，金额也必须相等",
              showCancel: false,
            })
            return;
          }
        }
        
				//当前验工计价进度为100%时修改提示
				console.log('传入参数', that.form);
				
        uni.showModal({confirmColor: '#eb4b4b',
          title: "温馨提示",
          content: tit,
          success: function (response) {
				  if (response.confirm) {
          console.log('传入参数' + that.currentNum);
          var inspectionTax = Number(that.form.currentInspectionMoney) * Number(that.baseList[0].taxrate) // 验工计价税额 = 本期验工金额*税率
          inspectionTax = that.farmatMoney(inspectionTax)
          var inspectionTaxAmount = that.farmatMoney(Number(that.form.currentInspectionMoney) + Number(inspectionTax))
            const detail = that.baseList[0].valuationDetails[that.baseList[0].valuationDetails.length-1]
        const data = {
          "pId": that.baseList[0].valuationId,
          "prjId": that.baseList[0].prjId,
          "subPrjId": that.baseList[0].subPrjId,
          "onlyBe1Flag": that.baseList[0].onlyBe1Flag,
          "siteId": that.baseList[0].siteId,
          "serviceCode": that.baseList[0].serviceCode,
          "currentInspectionNum": that.form.currentInspectionNum,
          "currentInspectionMoney": that.form.currentInspectionMoney,
          "sumMoney": that.form.sumMoney,
          "sumNum": that.form.sumNum,
          "projectProgress": that.form.projectProgress,
          "inspectionTax": inspectionTax,
          "inspectionTaxAmount": inspectionTaxAmount,
          "orderDetailId": that.baseList[0].orderDetailId,
          "purchaseMode": that.baseList[0].purchaseMode,
          "payType": that.form.payType,
          "flag": that.isEdit ? '2' : '1',
          "oldSumMoney": that.baseList[0].sumMoney,
          "oldSumNum": that.baseList[0].sumNum,
          "vId": detail?.valuationDetailId,
          "isApp": "1"
        }
        
        
				 // let params = [{
					//  valuationId:id,
				 // 	payType: "PROGRESSING",
				 // 	currentInspectionNum:that.currentNum,
				 // 	currentInspectionMoney: that.currentMen,
					// projectProgress:that.currentjindu,
					// action:"new",
					// }];
				console.log("参数"+JSON.stringify(data))
                  postApi('/material/api/insVa/app/updateValDetails',{data}).then(res=>{
                    uni.showModal({confirmColor: '#eb4b4b',
                      title: '温馨提示',
                      content: res.message,
                      showCancel: false,
                      success: function () {
                          //该方法用于刷新父页面
                          uni.navigateBack({
                            delta: 1
                          })
                      }
                    })
                  })
                  return
				// uni.request({
				// 	url: uni.getStorageSync('url') + "/pms/app/service/addValuationDetail",
				// 	method: 'POST',
				// 	dataType: 'json',
				// 	timeout: 10000 * 60,
				// 	header: {
				// 		'pmsToken': uni.getStorageSync('pmsToken')
				// 	},
				// 	data:params,
				//
				// 	success: (res) => {
				// 		uni.hideLoading();
				// 		//console.log('列表数据:' + JSON.stringify(res));
        //
				// 		var data = res.data;
				// 		var result = JSON.stringify(data)
				// 		console.log('列表数据:' + result);
				// 		if (data.resultStat == "000") {
				// 		uni.showModal({confirmColor: '#eb4b4b',
				// 			title: '温馨提示',
				// 			content: data.message,
				// 			showCancel: false,
				// 			success: function (res) {
				// 			        if (res.confirm) {
				// 			          //该方法用于刷新父页面
				// 					  uni.navigateBack({
				// 					  	delta: 1
				// 					  })
				//
				// 			        }
				// 			    }
				// 		})
				// 		} else {
				// 			uni.showModal({confirmColor: '#eb4b4b',
				// 				title: '温馨提示',
				// 				content: data.message,
				// 				showCancel: false,
				// 			})
				// 		}
        //
				// 		uni.hideLoading();
				// 		uni.stopPullDownRefresh();
        //
				// 	},
				// 	fail: (data, code) => {
				// 		uni.hideLoading();
				// 		uni.stopPullDownRefresh();
				// 		console.log('fail' + JSON.stringify(data));
				// 	}
				// });
				
				}
			}
		});
		
	},



	}
	}
</script>


<style>
	@import '@/common/common-ui.css';
 
</style>
